﻿@using CubicFWNet.Data.Models
@model Worksheet
@{
    var technology = ViewBag.Technology as Technology;
    var order = ViewBag.Order as Order;
    var product = ViewBag.Product as Product;
    var pac = ViewBag.ProductAccount;
    Layout = "~/Views/Shared/_InfoPage.cshtml";
}

<section class="content" style="overflow-x: scroll">
    @*style="overflow-x: scroll"*@
    <div class="box box-solid" style="width: 1500px;">
        <!-- /.box-header -->
        <div class="box-body">
            <div class="row">
                @if (Model != null && technology != null && order != null && product != null)
                {
                    <form class="form-horizontal" id="frmedit" action="@Url.Action("UpdateWorksheetStatus", "Worksheet")" method="post">
                        <span id="historyBack" class="btn btn-primary submitbtn" style="margin-left: 25px;">返回</span>
                        <span class="btn btn-primary submitbtn" id="print" onclick="print()" style="margin-left: 25px; display: inline-block">打印正面</span>
                        <span class="btn btn-primary submitbtn" id="printBack" onclick="printBack()" style="margin-left: 25px;display: inline-block">打印背面</span>
                        <span class="btn btn-primary bg-green submitbtn" style="margin-left: 25px; display: inline-block" onclick="formsubmit(1)">生产</span>
                        <span id="expExcel" class="btn btn-primary submitbtn" style="margin-left: 25px;">导出Excel</span>
                        <input type="hidden" id="Number" name="Number" value="@Model.Number"/>
                        <input type="hidden" id="ProductAccount" name="ProductAccount" value="@pac" />
                        <input type="hidden" id="Id" name="Id" value="@Model.Id"/>
                        <input type="hidden" id="WorkCount" name="WorkCount" value="@Model.WorkAmount" />
                        
                    </form>
                    <div id="queryDlg" style="width: 1480px; margin-left: 25px; margin-right: 25px;">
                        <div width="1480px" align="center">
                            <font size="6">切&nbsp;卷&nbsp;加&nbsp;工&nbsp;单</font><br>
                            <div style="text-align: center">
                            </div>
                        </div>
                        <table id="footable" cellspacing="0" cellpadding="0" border="1" style="font-size: 18px; width: 1480px; text-align: center">
                            <tbody>
                                <tr style="text-align: center;" class="tr">
                                    <td colspan="25" style="text-align: right">订单编号：@Model.Number</td>
                                </tr>
                                <tr style="text-align: center;" class="tr">
                                    <td rowspan="2" style="width: 80px;">订购人</td>
                                    <td rowspan="2" colspan="2" style="width: 120px;">日期</td>
                                    <td rowspan="2" colspan="4" style="width: 260px;">产品名称</td>
                                    <td rowspan="2">加工尺寸(宽mm)</td>
                                    <td rowspan="2" colspan="2">加工尺寸(长mm)</td>
                                    <td rowspan="2">计划加工数量</td>
                                    <td rowspan="2">实际加工数量</td>
                                    <td colspan="4" style="height: 12px;">领料情况</td>
                                    <td colspan="3" style="height: 12px;">退料及料头情况</td>
                                    <td rowspan="2" colspan="2">原材生产日期</td>
                                    <td rowspan="2" colspan="2">3M原批号</td>
                                    <td rowspan="2" style="width: 70px;">备注</td>
                                </tr>
                                <tr style="text-align: center; height: 37px;" class="tr">
                                    <td>整料规格(宽mm)</td>
                                    <td>计划数量</td>
                                    <td>实际数量</td>
                                    <td>散料规格(宽mm)</td>
                                    <td>退料(宽mm)</td>
                                    <td>边料(宽mm)</td>
                                    <td style="width: 40px;">数量</td>
                                </tr>
                                <tr style="text-align: center; height: 50px;" class="tr">
                                    <td>@order.CreatorName</td>
                                    <td colspan="2">@order.CreateTime</td>
                                    <td colspan="4">@product.Name</td>
                                    <td>@product.SizeWidth.Value.ToString("f2")</td>
                                    <td colspan="2">@product.SizeLenth.Value.ToString("f2")</td>
                                    <td>@Model.WorkAmount.ToString("f0")</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td colspan="2"></td>
                                    <td colspan="2"></td>
                                    <td></td>
                                </tr>
                                @for (int i = 0; i < 12; i++)
                                {
                                    <tr style="text-align: center; height: 45px;" class="noExl">
                                        <td></td>
                                        <td colspan="2"></td>
                                        <td colspan="4"></td>
                                        <td></td>
                                        <td colspan="2"></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td colspan="2"></td>
                                        <td colspan="2"></td>
                                        <td></td>
                                    </tr>
                                }
                                <tr style="text-align: center;" class="noExl">
                                    <td colspan="7" style="height: 30px; text-align: left">操作人：</td>
                                    <td rowspan="4" colspan="9"></td>
                                    <td rowspan="4" colspan="8"></td>
                                </tr>
                                <tr style="text-align: center; height: 30px; text-align: left" class="noExl">
                                    <td colspan="7">包装人：</td>
                                </tr>
                                <tr style="text-align: center; height: 30px; text-align: left" class="noExl">
                                    <td colspan="7">制单人：</td>
                                </tr>
                                <tr style="text-align: center; height: 30px; text-align: left" class="noExl">
                                    <td colspan="7">执行日：</td>
                                </tr>
                        </table>
                    </div>

                    <div style="margin-top: 30px;">
                        &nbsp;
                    </div>
                    <div id="queryDlgBack" style="width: 1480px; margin-left: 25px; margin-right: 25px;">

                        <table cellspacing="0" cellpadding="0" border="1" style="font-size: 18px; width: 1480px; text-align: center">
                            <tbody>
                                <tr style="text-align: center;">
                                    <td colspan="22">首检/巡检记录表</td>
                                </tr>
                                @for (int j = 0; j < 10; j++)
                                {
                                    <tr style="text-align: center;">
                                        <td colspan="2">产品名称</td>
                                        <td colspan="16"></td>
                                        <td>生产部</td>
                                        <td></td>
                                        <td>质检部</td>
                                        <td></td>
                                    </tr>
                                    <tr style="text-align: center;">
                                        <td colspan="2">抽检数量</td>
                                        @for (int i = 1; i < 21; i++)
                                        {
                                            <td style="width: 62px;">@i</td>
                                        }
                                    </tr>
                                    <tr style="text-align: center;">
                                        <td colspan="2">正负差</td>
                                        @for (int i = 1; i < 21; i++)
                                        {
                                            <td></td>
                                        }
                                    </tr>
                                    <tr style="text-align: center;">
                                        <td colspan="2">&nbsp;</td>
                                        @for (int i = 1; i < 21; i++)
                                        {
                                            <td></td>
                                        }
                                    </tr>
                                }
                        </table>
                    </div>
                }
            </div>
        </div>
    </div>
</section>

@section Scripts{
    <script src="~/Scripts/jquery.jqprint-0.3.js"></script>
    <script src="~/Scripts/jquery.table2excelBack.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#frmedit").validate({
                submitHandler: function (form) {
                    var postData = $(form).formSerialize();
                    $.submitForm({
                        url: $(form).attr("action"),
                        param: postData,
                        success: function () {
                            //$.reload();
                            $.modalAlert("操作成功", "success");
                            window.location.href = '@Url.Action("Check", "Worksheet")';
                        }
                    });
                }
            });
        });

        $("#expExcel").click(function () {
            $("#footable").table2excel({
                exclude: ".noExl",
                name: "切卷加工单",
                filename: "切卷加工单",
                exclude_img: false,
                exclude_links: false,
                exclude_inputs: false
            });
        });

        function formsubmit(t) {
            $("#frmedit").submit();
        }


        $("#historyBack").click(function () {
            window.history.go(-1);  //返回上一页
            //window.history.back();  //返回上一页
        });

        function print() {
            $('#queryDlg').jqprint();
        }
        function printBack() {
            $('#queryDlgBack').jqprint();
        }
    </script>
}
